how single page application work in react